﻿@{
    ViewBag.Title = "提现记录";
    ViewBag.PathToBtn = "/Withdrawals/List";
    ViewBag.TextBtn = "刷新";
    Layout = "~/Views/Shared/_Layout.cshtml";

}
@model  Matrix.MaKaYunShang.Model.McCashWithdrawApplication
@section css{
    <style type="text/css">
        .nav-tabs li {
            cursor: pointer;
        }

        .table hr {
            margin: 5px 0;
            border: dashed 1px #aaa;
        }

        .dataTables_length {
            display: none;
        }

        .dataTables_filter {
            display: none;
        }
    </style>
}
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">


                <div class="form-group col-md-6">

                    <div class="input-group-sm">
                        <label> 总收入金额:<span style=" color:red" id="totalIncomeOfShopAmount">@ViewBag.totalIncomeOfShopAmount</span>元 </label>

                        <label> 可提现金额:<span style=" color:red" id="CashWithdrawalAmount">@ViewBag.CashWithdrawalAmount</span>元 </label>

                        <a id="btnPutaway" href="javascript:Withdrawals();" class="btn btn-success" style=" margin-left:8px">提现</a>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- /.row -->
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                提现记录
            </div>
            <!-- /.panel-heading -->
            <div class="panel-body">
                <ul class="nav nav-tabs">
                    <li>
                        <a data-toggle="tab" tag="-1">全部</a>
                    </li>
                    <li>
                        <a data-toggle="tab" tag="1">处理成功</a>
                    </li>
                    <li>
                        <a data-toggle="tab" tag="0">待处理</a>
                    </li>
                    <li>
                        <a data-toggle="tab" tag="2">处理失败</a>
                    </li>
                    <input type="hidden" id="HidDealStatus" value="@ViewBag.DealStatus" />
                </ul>
                <div class="dataTable_wrapper">
                    <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                        <thead>
                            <tr>
                                <th>申请时间</th>
                                <th>银行名称</th>
                                <th>银行账号</th>
                                <th>开户行</th>
                                <th>银行卡账户名称</th>
                                <th>提现金额</th>
                                <th>备注</th>
                                <th>状态</th>

                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
                <!-- /.table-responsive -->
            </div>
            <!-- /.panel-body -->
        </div>
        <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>
<!-- /.row -->
@section javascript{
    <script src="/Content/admin/dist/js/pagingHelper.js"> </script>
    <script type="text/javascript">
        var dataParams = {};
        var serverProcessPath = "/Withdrawals/Listing";
        var showColumns = [
            { data: "ApplyTimeStr" },
            { data: "BankName" },
            { data: "BankAccount" },
            { data: "BankOfDeposit" },
            { data: "BankAccountName" },
            { data: "CashValue" },
            { data: "Remark" },
            { data: "DealStatusStr" }

        ];
        pagingHelper.Paging(serverProcessPath, dataParams, showColumns);
        $(function () {
            $("#btnAssign").click(function () {
                $.post("@Url.Action("Assign")", "orderId=" + $("#hidOrderId").val() + "&deliveryId=" + $("#Delivery").val(), function (data) {
                    if (data.Status) {
                        $("#assignModal").modal("hide");
                        alertify.success(data.Message);
                        reloadOrder();
                    } else {
                        alertify.error(data.Message);
                    }
                });
            });

            $(".nav-tabs li a").click(function () {
                $("#HidDealStatus").val($(this).attr("tag"));
                reloadOrder();
            });

            $(".nav-tabs li a[tag='@(ViewBag.OrderStatus)']").parent().addClass("active").siblings().removeClass("active");

            $("#btnSearch").click(function () {
                reloadOrder();
            });
        });
        function reloadOrder() {
            @*pagingHelper.reloadWithDiffPath("@Url.Action("Listing")" + "?keyWords=" + $("#keyWords").val() + "&orderNo=" + $("#orderNo").val() + "&startTime=" + $("#startTime").val() + "&endTime=" + $("#endTime").val() + "&orderStatus=" + $("#hidOrderStatus").val());*@

            pagingHelper.reloadWithDiffPath("@Url.Action("Listing")" + "?&DealStatus=" + $("#HidDealStatus").val());
        }
        function Withdrawals() {
            var amount = $("#CashWithdrawalAmount").html();

            if (amount < 1) {

                alertify.alert("暂无提现额度,无法操作!");

            }
            else if (amount < 100) {
                alertify.alert("最低提现金额为100元!");
            }
            else {

                location.href = "/Withdrawals/WithdrawOperation";
            }
        }
    </script>
}